//
//  HZSettingAndHelpViewController.m
//  MyDoctor
//
//  Created by 黑眼圈 on 16/5/5.
//  Copyright © 2016年 heiyan. All rights reserved.
//设置与帮助

#import "HZSettingAndHelpViewController.h"


@interface HZSettingAndHelpViewController ()<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic,strong)UITableView * tableView;
//设置和帮助按钮数据数组
@property(nonatomic,strong)NSArray * array;

@end
static NSString * identifier = @"settingCell";
@implementation HZSettingAndHelpViewController

#pragma mark -
#pragma mark 懒加载数据数组
-(NSArray *)array{
    if (!_array) {
        _array = [ HZSettingAndHelpModel getSettingAndHelpArray];
    }
    return _array;
}

#pragma mark -
#pragma mark 懒加载tableView
-(UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc]init];
    }
    return _tableView;
}

#pragma mark -
#pragma mark 设置view为tableView
-(void)loadView{
    
    self.view = self.tableView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //设置并添加子控件
    [self setupUI];
    
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:identifier];
    
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    
}


#pragma mark -
#pragma mark    设置并添加子控件
-(void)setupUI{
    
    self.view.backgroundColor = [UIColor whiteColor];
    

    
}


#pragma mark -
#pragma mark datasource

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
    HZSettingAndHelpModel * model = self.array[indexPath.row];
    
    cell.textLabel.text = model.title;
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    return cell;

}

#pragma mark -
#pragma mark delegate

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    switch (indexPath.row ) {
        case 0:{
            HZSuggestTableViewController * sug = [[HZSuggestTableViewController alloc]init];
            [self.navigationController pushViewController:sug animated:YES];
            sug.title = @"意见反馈";
            sug.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"JianTou"] style:UIBarButtonItemStyleDone target:self action:@selector(didLeftItem)];
            
            break;
        }
            
       
            
        default:
            break;
    }
}



-(void)didLeftItem{
   
    [self.navigationController popViewControllerAnimated:YES];
}




@end
